main(i)
{
	double n;
	char s[9];
	for(i=1,gets(s);~scanf("%lf%s",&n,s);)
	{
		printf("%d ",i++);
		if(!strcmp(s,"kg"))
			printf("%.4lf lb\n",n*2.2046);
		if(!strcmp(s,"l"))
			printf("%.4lf g\n",n*0.2642);
		if(!strcmp(s,"lb"))
			printf("%.4lf kg\n",n*0.4536);
		if(!strcmp(s,"g"))
			printf("%.4lf l\n",n*3.7854);
	}
}
